package kr.co.webmill.dao;

import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

public class TodoTable {
	public static final String TABLE_todo = "todo";
	public static final String COLUMN_ID = "_id";
	public static final String COLUMN_CATEGORY = "category";
	public static final String COLUMN_SUMMERY = "summery";
	public static final String COLUMN_DESCRIPTION = "description";
	
	public static final String CREATE_TABLE = "create table " 
	+ TABLE_todo
	+ "("
	+ COLUMN_ID + " integer primary key autoincrement,"
	+ COLUMN_CATEGORY + " text NOT NULL,"
	+ COLUMN_SUMMERY + " text NOT NULL,"
	+ COLUMN_DESCRIPTION + " text NOT NULL"
	+ ");";
	
	public static final String DEL_TABLE = "DROP TABLE IF EXISTS TABLE " 
			+ TABLE_todo + ";";
	
	public static void onCreate(SQLiteDatabase database){
		database.execSQL(CREATE_TABLE);
	}
	public static void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion){
		Log.w(TodoTable.class.getName(), "Upgrading " + Integer.toString(oldVersion)
				+ " to " + Integer.toString(newVersion)
				+ " will destroy all saved data");
		database.execSQL(DEL_TABLE);
	}
}
